-
Notifications
You must be signed in to change notification settings - Fork 109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for participant count #944
base: 6.x
Are you sure you want to change the base?
Conversation
I'll address these failures tomorrow. |
test this please |
I just kicked off the test by pushing a trivial commit to your |
1037adf
to
7ca57d9
Compare
I'll resolve the conflict here soon. This should pass existing tests, but I have new tests that aren't all passing. Event line items have always been a little inconsistent in WFC and I need to figure out how consistent they need to be made to support this. |
Ah cool on the test! If needed we can bring this over the finish line in Montreal! |
bddbbf4
to
ec465b4
Compare
OK - this is now updated to create line items correctly in both "register all for same event" and "register each contact separately". Previously - line items were created correctly only when "register each contact separately" was selected. When "register all for same event" was selected, one line item was created for the entire transaction. This threw off participant count calculations, which assume if there's a missing line item, the count is 1. So registering 3 people for 4 seats each would take up 14 places, not 12 (since contact 1 would have a line item for 12 places, contacts 2 and 3 would have no line items). My latest changes ensure that separate line items are created for each participant record. |
fix for participant count code
ec465b4
to
20fa33d
Compare
return $qtyPriceFieldValueId; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be moved to an upgrade hook?
Overview
In event price sets, a price option can have a "participant count". E.g. purchasing a "table for 10" ticket will increment the participant count by 10 despite buying one ticket. This PR adds support for participant counts in WFC.
Before
All tickets purchased count as one participant.
After
A "participant count" field exists This can be a numeric input, Computed Twig, etc.
The "Fee Amount" is not affected by the count. If you want the fee amount to be "per participant", you'll use Twig.
Technical Details
Participant count requires a line item with a non-NULL
price_field_value_id
). WFC has line items for paid events only. We never populateprice_field_value_id
.So:
AdminHelp.php
andFields.php
).Utils.php
function returns that price field value, and will create it if it doesn't exist.qty
andunit_price
to be count-aware (if used). We include the requiredline_total
andprice_field_value_id
so participant count is calculated correctly.Comments
When testing, note that API4's "remaining participants" calculated field is inaccurate for multiple reasons. To view an accurate count, call Api3
event.get
and return underdocumented valueis_full
(see screenshot).